<?php
/**
 * Created by PhpStorm.
 * User: yangfan
 * Date: 2019/11/16
 * Time: 3:39 PM
 */

namespace App\BO\Order;

use App\BO\Order\CreateOrder\ProductInfo;
use App\Entities\AreaEntity;
use App\Entities\CartItemEntity;
use App\Entities\CooperatorModel;
use App\Entities\CouponCodeEntity;
use App\Entities\UserAddressEntity;
use App\Entities\UserCouponEntity;
use App\Entities\UserEntity;
use App\Meta\OrderPeriodDate;

class CreateOrderItem implements ICreateOrderItem
{
    /**
     * 优惠券抵扣掉的价值，单位为 分
     * @var int
     */
    protected $couponDiscountValue = 0;

    /**
     * 产品用户计算的价格
     * @var int
     */
    protected $productSkuCalculatePrice = 0;

    /**
     * 使用的余额具体数字
     * @var int
     */
    protected $useBalanceAmount = 0;

    /**
     * 是否检查产品销售区域
     * @var bool
     */
    protected $checkProductRange = true;

    /**
     * 购物车信息
     * @var CartItemEntity
     */
    protected $cartItemEntity;

    /**
     * 下单用户信息
     * @var UserEntity
     */
    protected $userEntity;

    /**
     * 订单地址
     * @var UserAddressEntity
     */
    protected $orderAddress;

    /**
     * 用户当前选择的城市
     * @var AreaEntity
     */
    protected $currentAddress;

    /**
     * 是否使用余额
     * @var bool
     */
    protected $useBalance = false;

    /**
     * 是否使用优惠券
     * @var bool
     */
    protected $useCoupon = false;

    /**
     * 产品信息
     * @var ProductInfo
     */
    protected $product;

    /**
     * 订单备注
     * @var string
     */
    protected $remark = '';

    /**
     * @var UserCouponEntity
     */
    protected $userCouponEntity;

    /**
     * @var CouponCodeEntity
     */
    protected $couponEntity;

    /**
     * @var OrderPeriodDate
     */
    protected $serviceDate;

    /**
     * @var int
     */
    protected $channelId = CooperatorModel::PAY_MINI;

    /**
     * @param UserEntity $userEntity
     */
    public function setUserEntity(UserEntity $userEntity): void
    {
        $this->userEntity = $userEntity;
    }

    /**
     * @return UserEntity
     */
    public function getUserEntity(): UserEntity
    {
        return $this->userEntity;
    }

    /**
     * @param bool $useBalance
     */
    public function setUseBalance(bool $useBalance): void
    {
        $this->useBalance = $useBalance;
    }

    /**
     * @return bool
     */
    public function useBalance(): bool
    {
        return $this->useBalance;
    }

    /**
     * @param ProductInfo $product
     */
    public function setProduct(ProductInfo $product): void
    {
        $this->product = $product;
    }

    /**
     * @return ProductInfo
     */
    public function getProduct(): ProductInfo
    {
        return $this->product;
    }

    /**
     * @return string
     */
    public function getRemark(): string
    {
        return $this->remark;
    }

    /**
     * @param string $remark
     */
    public function setRemark(string $remark): void
    {
        $this->remark = $remark;
    }

    /**
     * @inheritDoc
     */
    public function useCoupon(): bool
    {
        return $this->useCoupon;
    }

    /**
     * @param bool $useCoupon
     */
    public function setUseCoupon(bool $useCoupon): void
    {
        $this->useCoupon = $useCoupon;
    }

    /**
     * @return UserCouponEntity
     */
    public function getUserCouponEntity(): UserCouponEntity
    {
        return $this->userCouponEntity;
    }

    /**
     * @param UserCouponEntity $userCouponEntity
     */
    public function setUserCouponEntity(UserCouponEntity $userCouponEntity): void
    {
        $this->userCouponEntity = $userCouponEntity;
    }

    /**
     * @return UserAddressEntity
     */
    public function getOrderAddress(): UserAddressEntity
    {
        return $this->orderAddress;
    }

    /**
     * @param UserAddressEntity $orderAddress
     */
    public function setOrderAddress(UserAddressEntity $orderAddress): void
    {
        $this->orderAddress = $orderAddress;
    }

    /**
     * @return AreaEntity
     */
    public function getCurrentAddress(): AreaEntity
    {
        return $this->currentAddress;
    }

    /**
     * @param AreaEntity $currentAddress
     */
    public function setCurrentAddress(AreaEntity $currentAddress): void
    {
        $this->currentAddress = $currentAddress;
    }

    /**
     * @return bool
     */
    public function isCheckProductRange(): bool
    {
        return $this->checkProductRange;
    }

    /**
     * @return CartItemEntity
     */
    public function getCartItemEntity(): CartItemEntity
    {
        return $this->cartItemEntity;
    }

    /**
     * @param CartItemEntity $cartItemEntity
     */
    public function setCartItemEntity(CartItemEntity $cartItemEntity): void
    {
        $this->cartItemEntity = $cartItemEntity;
    }

    /**
     * @return OrderPeriodDate
     */
    public function getServiceDate(): OrderPeriodDate
    {
        return $this->serviceDate;
    }

    /**
     * @param OrderPeriodDate $serviceDate
     */
    public function setServiceDate(OrderPeriodDate $serviceDate): void
    {
        $this->serviceDate = $serviceDate;
    }

    /**
     * @return int
     */
    public function getChannelId(): int
    {
        return $this->channelId;
    }

    /**
     * @return CouponCodeEntity
     */
    public function getCouponEntity(): CouponCodeEntity
    {
        return $this->couponEntity;
    }

    /**
     * @param CouponCodeEntity $couponEntity
     */
    public function setCouponEntity(CouponCodeEntity $couponEntity): void
    {
        $this->couponEntity = $couponEntity;
    }

    /**
     * @return int
     */
    public function getProductSkuCalculatePrice(): int
    {
        return $this->productSkuCalculatePrice;
    }

    /**
     * @param int $productSkuCalculatePrice
     */
    public function setProductSkuCalculatePrice(int $productSkuCalculatePrice): void
    {
        $this->productSkuCalculatePrice = $productSkuCalculatePrice;
    }

    /**
     * @return int
     */
    public function getCouponDiscountValue(): int
    {
        return $this->couponDiscountValue;
    }

    /**
     * @param int $couponDiscountValue
     */
    public function setCouponDiscountValue(int $couponDiscountValue): void
    {
        $this->couponDiscountValue = $couponDiscountValue;
    }

    /**
     * @return int
     */
    public function getUseBalanceAmount(): int
    {
        return $this->useBalanceAmount;
    }

    /**
     * @param int $useBalanceAmount
     */
    public function setUseBalanceAmount(int $useBalanceAmount): void
    {
        $this->useBalanceAmount = $useBalanceAmount;
    }
}
